package com.cy.ppj.web.admin.order;

import com.cy.ppj.model.PageBean;
import com.cy.ppj.model.Result;
import com.cy.ppj.model.query.customer.CustomerAuthRecordQuery;
import com.cy.ppj.model.query.order.JydOrderListAdminQuery;
import com.cy.ppj.model.vo.customer.CustomerAuthDetailVO;
import com.cy.ppj.model.vo.customer.CustomerAuthRecordVO;
import com.cy.ppj.model.vo.order.ImageListVO;
import com.cy.ppj.model.vo.order.JydOrderDetailAdminVO;
import com.cy.ppj.model.vo.order.JydOrderListAdminVO;
import com.cy.ppj.service.order.JydOrderService;
import com.cy.ppj.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description 后台-家易贷订单管理
 * @Author tanyilin
 * @Date 2019/6/27 15:44
 */
@RestController
@RequestMapping("/admin/mall/jyd/order")
@Api(tags = "后台-家易贷订单管理")
public class AdminJydOrderController extends BaseController {

    @Autowired
    private JydOrderService jydOrderService;

    @ApiOperation("申请中-订单")
    @GetMapping("/applying/list")
    public PageBean<JydOrderListAdminVO> getApplyingOrderList(JydOrderListAdminQuery query) {

        PageBean<JydOrderListAdminVO> pageBean = jydOrderService.selectApplyingJydOrderList(query);
        return pageBean;
    }

    @ApiOperation("已授信-订单")
    @GetMapping("/decision/pass/list")
    public PageBean<JydOrderListAdminVO> getDecisionPassOrderList(JydOrderListAdminQuery query) {

        PageBean<JydOrderListAdminVO> pageBean = jydOrderService.selectDecisionPassJydOrderList(query);
        return pageBean;
    }

    @ApiOperation("已放款-订单")
    @GetMapping("/loan/success/list")
    public PageBean<JydOrderListAdminVO> getLoanSuccessOrderList(JydOrderListAdminQuery query) {

        PageBean<JydOrderListAdminVO> pageBean = jydOrderService.selectLoanSuccessJydOrderList(query);
        return pageBean;
    }

    @ApiOperation("申请拒绝-订单")
    @GetMapping("/reject/list")
    public PageBean<JydOrderListAdminVO> getRejectOrderList(JydOrderListAdminQuery query) {

        PageBean<JydOrderListAdminVO> pageBean = jydOrderService.selectRejectJydOrderList(query);
        return pageBean;
    }

    @ApiOperation("订单详情")
    @GetMapping("/detail")
    public Result<JydOrderDetailAdminVO> getOrderDetail(@RequestParam(value = "orderId") Long orderId) {

        JydOrderDetailAdminVO detailAdminVO = jydOrderService.getOrderDetail(orderId);

        return ok("获取订单详情成功", detailAdminVO);
    }

    @ApiOperation("获取影音资料")
    @GetMapping("/get/image/list")
    public Result<List<ImageListVO>> getImageList(@RequestParam(value = "orderId") Long orderId, @RequestParam(value = "customerId") Long customerId) {

        List<ImageListVO> imageList = jydOrderService.getOrderImageList(orderId, customerId);

        return ok("获取成功", imageList);
    }

    @ApiOperation("客户实名认证记录")
    @GetMapping("/get/customer/auth/record")
    public PageBean<CustomerAuthRecordVO> getAuthRecord(CustomerAuthRecordQuery query) {

        PageBean<CustomerAuthRecordVO> pageBean = jydOrderService.selectCustomerAuthRecord(query);

        return pageBean;

    }

    @ApiOperation("客户实名认证详情")
    @GetMapping("/get/customer/auth/detail")
    public Result<CustomerAuthDetailVO> getCustomerAuthDetail(@RequestParam(value = "customerId") Long customerId) {

        CustomerAuthDetailVO detailVO = jydOrderService.getCustomerAuthDetail(customerId);

        return ok("获取详情信息成功", detailVO);
    }

}
